<?php

class PageView {
	private $m_charset;
	//private $errormessages = array();
	public function __construct($charset = "utf-8") {
		$this -> myCharset = $charset;
	}

	public function getXHTMLPage($title, $body) {
		$xml = "
        <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"> 
        <html xmlns=\"http://www.w3.org/1999/xhtml\"> 
          <head> 
             <title>$title</title> 
             <meta http-equiv=\"content-type\" content=\"text/html; charset=$this->myCharset\" /> 
             <link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />
          </head> 
          <body>
            $body
          </body>
        </html>";
		return $xml;
	}

	public function createHeader($links) {
		// Create box-div, menu and show errormessages if there are any
		$xml = "<div class='box'><ul class='menu'>";
		foreach ($links as $link) {
			$xml .= "<li>$link</li>";
		}
		$xml .= "</ul>";
		foreach (Feedback::$errorsArray as $msg) {
			$xml .= "<p class='error'>$msg</p>";
		}
		return $xml;
	}

	public function createFooter($text) {
		return "</div><div class='footer'>$text</div>";
	}

}
